package com.ttg.common.entities;

import lombok.Data;

import java.io.Serializable;

/**
 * @author ZQ
 * @version 1.0
 * @Description
 * @date 2021/1/5 16:53
 */
@Data
public class PagesRes implements Serializable {
    private static final long serialVersionUID = 6225728110340685901L;
    /**
     * 总数
     */
    private long totalnum = 0;

    /**
     * 每页条数 默认10条
     */
    private long pagesize = 10;
    /**
     * 页码
     */
    private long page = 1;
    public PagesRes(){

    }
    public PagesRes(long totalnum, long pagesize, long page) {
        this.totalnum = totalnum;
        this.pagesize = pagesize;
        this.page = page;
    }

    public long getTotalpage() {
        if (totalnum == 0) {
            return 0L;
        }
        long pages = totalnum / pagesize;
        if (totalnum % pagesize != 0) {
            pages++;
        }
        return pages;
    }
}
